package com.kaibes.core.spring.bean;

import java.util.ArrayList;
import java.util.List;

public class BeanFilterBuilder {

    private boolean included;
    private List<String> fields = new ArrayList<String>();
    
    public BeanFilterBuilder setIncluded(boolean included) {
        this.included = included;
        return this;
    }
    
    public BeanFilterBuilder addField(String field) {
        fields.add(field);
        return this;
    }
    
    public BeanFilter build() {
        BeanFilter filter = new BeanFilter();
        filter.setIncluded(included);
        if (!fields.isEmpty()) {
            filter.setFields(fields);
        }
        return filter;
    }
    
}
